package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum LoginType {
	
	SHOP(0,"商家登录"),
	OPERATION(1,"代理登录"),
	INTERNAL(2,"内部登录");
	
	private Integer type;
	
	private String value;

	private LoginType(Integer status,String value){
		this.type = status;
		this.value = value;
	}

	public int toIntType() {
		return this.type;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static LoginType toFlag(int type) {
		if (SHOP.type == type) {
			return SHOP;
		} else if (OPERATION.type == type) {
			return OPERATION;
		} else if (INTERNAL.type == type) {
			return INTERNAL;
		} else {
			throw new InvalidArgumentException("Unknown type[" + type + "].");
		}
	}
}
